///////////////////////////////////////////////////////////////////////////////////////////////////
/// \file matrix_actor.h
///
/// \brief   header file for the matrix actor base class
///
///////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef PCPS_MATRIX_ACTOR_HEADER
#define PCPS_MATRIX_ACTOR_HEADER

namespace pcps {

  ///////////////////////////////////////////////////////////////////////////////////////////////////
  /// \brief   Base class for objects that perform matrix-vector products for a matrix A.
  ///          Note that the children of this class do not necessarily build and store A.
  ///          Rather, they are only required to compute matrix-vector products of the form y = A x.
  ///
  ///////////////////////////////////////////////////////////////////////////////////////////////////

  template<class S> class MatrixActor {

    public:

      ///////////////////////////////////////////////////////////////////////////////////////////////////
      /// \brief  performs the matrix-vector multiplication y = A x
      ///
      /// \param[in]      n        the length of the x and y arrays
      /// \param[in]      x        the vector on which to operate
      /// \param[out]     y        on exit, the result of the multiplication A x
      ///
      ///////////////////////////////////////////////////////////////////////////////////////////////////
      virtual void operate(const int n, const S * const x, S * const y) = 0;

      /// \brief  make destructor virtual so that deleting a pointer-to-base will call childrens' destructors
      virtual ~MatrixActor() {}

  };

} // end namespace pcps

#endif
